package com.example.fx.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.CommentEntity
import com.example.fx.R
import com.example.fx.utils.GlideUtils

class CommentAdapter:BaseMultiItemQuickAdapter<CommentEntity,BaseViewHolder>() {
    init {
        addItemType(0, R.layout.item_comment_0)
        addItemType(1, R.layout.item_comment_1)
        addItemType(2, R.layout.item_comment_2)
    }
    override fun convert(holder: BaseViewHolder, item: CommentEntity) {
        when(holder.itemViewType){
            0,2->{
                GlideUtils.loadImage(context,item.icon,holder.getView(R.id.icon))
                holder.setText(R.id.username,item.username)
                holder.setText(R.id.msg,item.msg)
            }
            1->{
                holder.setText(R.id.tv_count,"----展开${item.childcount}条评论----")
            }
        }
    }
}